package com.leet.code.lcof;

public class Code64 {

    public static void main(String[] args) {
        Code64 code64 = new Code64();
        for (int i = 0; i <= 100; i++) {
            int sum = (1 + i) * (i / 2) + (i % 2) * (i / 2 + 1);
            System.out.println(i + ":" + code64.sumNums(i) + ":" +sum);
        }

    }

    public int sumNums1(int n) {
        return (1 + n) * (n >> 1) + (n & 1) * ((n >> 1) + 1);
    }


    public int sumNums(int n) {
        boolean b = (n > 0) && (n = n + (sumNums(n - 1))) > 1;
        return n;
    }

}
